package com.aaa.service.impl;

import com.aaa.dao.F_TiXiDao;
import com.aaa.service.F_TiXiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
@Service
public class F_TiXiServiceimpl  implements F_TiXiService {
    @Autowired
    F_TiXiDao dao;
    @Override
    public List<Map> selectList(Map map) {
        return dao.selectList(map);
    }

    @Override
    public Integer getCount(Map map) {
        return dao.getCount(map);
    }

    @Override
    public List<Map> getYear() {
        return dao.getYear();
    }

    @Override
    public int update(Map map) {
        //根据name 获取年份id
        int x=  dao.getid(map);
       // System.out.println(x);
        map.put("yearid",x);
        return dao.update(map);
    }

    @Override
    public int add(Map map) {
        //根据name 获取年份id
        int x=  dao.getid(map);
       // System.out.println(x);
        map.put("yearid",x);
        return dao.add(map);
    }

    @Override
    public int del(Integer id) {
        int g = 1;
        //查询是否有子项目 有 无法删除
        List<Map> x= dao.getConter(id);
        if (x.size()>0) {
            g=4;
        }else {
            dao.del(id);
        }
        return g;
    }
}
